import { request } from '../utils/request.js'

// 获取所有的优惠劵信息
export const getAllCoupons = () => request({ url: '/coupons/searchCoupons' })

// 兑换优惠劵
export const exchangeCoupons = (data) =>
  request({ url: '/userCoupons/exchangeCoupon', data, method: 'POST' })

// 查询优惠劵
export const getCouponService = (userId) =>
  request({ url: `/userCoupons/getCoupon/${userId}` })

// 根据优惠劵id查询
export const getCouponDetail = (id) =>
  request({ url: `/coupons/getCoupons/${id}` })

// 更新用户优惠劵表信息
export const updateCoupon = (data) =>
  request({ url: '/userCoupons/updateCoupon', data, method: 'POST' })

// 删除用户优惠卷表信息
export const delUserCoupon = (id) =>
  request({ url: `/userCoupons/delCoupon/${id}`, method: 'DELETE' })
